package com.xxl.job.executor.crawler.util;

import com.gargoylesoftware.htmlunit.Page;
import com.xxl.job.executor.crawler.job.AllSpecialProduct;
import org.jsoup.nodes.Element;

import org.jsoup.nodes.Document;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 描述:
 *
 * @author Pfly
 * @create 2019-01-05 16:23
 */
public class ItemIdUtil {


    /*public List<String> getItemId(AllSpecialProduct.PageVo pageVo ,Document html){
        Element body = html.body();

        List<String> special_sku = pageVo.getSpecial_sku();
        List<String> item_id = new ArrayList<>();
        for (String s : special_sku) {

            String  [] txt = s.split("<span class=\"value\">");
            for (String a : txt){
                a = getNumbers(a); //截取字符串中的数字
                if(!a.equals("") || a != null) {
                    if(a.length() > 7 ){
                        item_id.add(a);
                    }
                }
            }
        }
        return item_id;
    }

    public String getNumbers(String content) {
        Pattern pattern = Pattern.compile("\\d+");
        Matcher matcher = pattern.matcher(content);
        while (matcher.find()) {
            return matcher.group(0);
        }
        return "";
    }*/
}
